﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using App.BLL;
using App.DAL;
using App.IBLL;
using App.IDAL;
using Microsoft.Practices.Unity;

namespace App.Core
{
    public class DependencyRegisterType
    {
        public static void Container_Sys(ref UnityContainer container)
        {
            //系统注入
            container.RegisterType<ISysSampleRepository, SysSampleRepository>();
            container.RegisterType<ISysSampleBLL, SysSampleBLL>();

            container.RegisterType<IMenuBLL, MenuBLL>();
            container.RegisterType<IMenuRepository, MenuRepository>();

            container.RegisterType<ISysLogBLL, SysLogBLL>();
            container.RegisterType<ISysLogRepository, SysLogRepository>();

            //属性注入时可根据关键字(括号里面的名称)调用特定的方法,调用方法参考AccountController中的调用方法
            container.RegisterType<IAccountBLL, TestBLL>("test");
            container.RegisterType<IAccountBLL, AccountBLL>("new");
            container.RegisterType<IAccountRepository, AccountRepository>();

            container.RegisterType<ISysModuleBLL, SysModuleBLL>();
            container.RegisterType<ISysModuleRepository, SysModuleRepository>();

            container.RegisterType<ISysModuleOperateBLL, SysModuleOperateBLL>();
            container.RegisterType<ISysModuleOperateRepository, SysModuleOperateRepository>();

            container.RegisterType<ISysRoleBLL, SysRoleBLL>();
            container.RegisterType<ISysRoleRepository, SysRoleRepository>();

            container.RegisterType<ISysRightBLL, SysRightBLL>();
            container.RegisterType<ISysRightRepository, SysRightRepository>();

            container.RegisterType<ISysUserBLL, SysUserBLL>();
            container.RegisterType<ISysUserRepository, SysUserRepository>();
        }
    }
}
